package com.tengju.user.domain.model.sign;

import com.tengju.user.domain.model.survey.SurveyQuestionResult;
import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 *
 */
@Getter
public class ExamQuestionAnswer {

    String questionCode;

    String questionAnswer;

    BigDecimal questionScore;

    public ExamQuestionAnswer(String questionCode, String questionAnswer, BigDecimal score) {
        this.questionCode = questionCode;
        this.questionAnswer = questionAnswer;
        this.questionScore = score;
    }

    public ExamQuestionAnswer() {
    }

    public boolean judgeAnswer(SurveyQuestionResult result) {
        if (result == null) {
            return false;
        }
        if (!Objects.equals(questionCode,result.getQuestionCode())) {
            throw new StarSignException("考试题目code不一致");
        }
        return Objects.equals(questionAnswer,result.getQuestionContent());
    }
}
